package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.core.Result;
import org.jsola.hr.vo.DynamicCodeVO;
import org.jsola.hr.vo.QRCodeVO;

@Api(tags = "hr-小程序")
public interface IMiniProgramControllerAPI {

    @ApiOperation(value = "获取二维码")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "用工单位id", paramType = "query")
    })
    Result<QRCodeVO> getQRCode(String companyId);

    @ApiOperation(value = "生成二维码")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "qrCodeVO", dataType = "QRCodeVO", value = "生成二维码参数对象", paramType = "body"),
    })
    Result<QRCodeVO> generateQRCode(QRCodeVO qrCodeVO);

    @ApiOperation(value = "根据缓存key获取二维码信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "key", dataType = "String", value = "缓存key", paramType = "query")
    })
    Result<QRCodeVO> getByKey(String key);

    @ApiOperation(value = "根据用工单位id获取扫码入职信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "用工单位id", paramType = "query")
    })
    Result<QRCodeVO> getQRCodeByCompanyId(String companyId);


    /**
     * 管理端小程序生成二维码
     *
     * @param companyId 用工单位id
     * @param channelId 渠道id
     * @param type      类型; 1:预登记 2:待入职
     * @return 二维码对象
     */
    @ApiOperation(value = "管理端小程序生成二维码")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "用工单位id", paramType = "query"),
            @ApiImplicitParam(name = "channelId", dataType = "String", value = "渠道id", paramType = "query"),
            @ApiImplicitParam(name = "type", dataType = "Integer", value = "类型; 1:预登记 2:待入职", paramType = "query")
    })
    Result<QRCodeVO> getManageQRCode(String companyId, String channelId, Integer type);

    /**
     * 根据用工单位id获取动态码
     *
     * @param companyId 用工单位id
     * @param channelId 渠道id
     * @param oldCode   之前的的动态码
     * @param type      类型; 1:预登记 2:待入职
     * @return 动态码对象
     */
    @ApiOperation(value = "根据用工单位id获取动态码")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "用工单位id", paramType = "query", required = true),
            @ApiImplicitParam(name = "channelId", dataType = "String", value = "渠道id", paramType = "query"),
            @ApiImplicitParam(name = "oldCode", dataType = "String", value = "之前的的动态码", paramType = "query"),
            @ApiImplicitParam(name = "type", dataType = "Integer", value = "类型; 1:预登记 2:待入职", paramType = "query"),
    })
    Result<DynamicCodeVO> getDynamicCode(String companyId, String channelId, String oldCode, Integer type);


    /**
     * 根据动态码获取用工单位信息
     *
     * @param code 动态码
     * @return 动态码对象
     */
    @ApiOperation(value = "根据动态码获取用工单位信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "code", dataType = "String", value = "动态码", paramType = "query", required = true)
    })
    Result<DynamicCodeVO> getByDynamicCode(String code);

    /**
     * 生成发薪的二维码
     *
     * @param batchId   批次id
     * @param batchType 发薪类型
     * @param siteId    租户id
     * @return 二维码url
     */
    @ApiOperation(value = "生成发薪的二维码")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "batchId", dataType = "String", value = "批次id", paramType = "query"),
            @ApiImplicitParam(name = "batchType", dataType = "Integer", value = "发薪类型", paramType = "query"),
            @ApiImplicitParam(name = "siteId", dataType = "String", value = "租户id", paramType = "query")
    })
    Result<String> generateSalaryQRCode(String batchId, Integer batchType, String siteId);
}
